// 购物车接口

import request from '../utils/request'

// 添加购物车
export const addCart = (data) => request.post('cart/add',data)
// http://demo.itlike.com/web/xlmc/api/cart/add   post
// goods_id: "5b150c9bc0a1ea13728b4576"
// goods_name: "粮全其美葱香味手抓饼 900g/袋"
// goods_price: "18.80"
// small_image: "https://ddimg.ddxq.mobi/becc0e6b257781528108118451.jpg!maicai.product.list"
// user_id: "614d1c5cb0fb2153367af21f"

// 购物车列表
export const getCartList = (token) => request.get(`cart/search/${token}`)

// 取消商品被选中
export const goodsSelect = (data) => request.post('cart/singer_select',data)
// goods_id: "5ceb7df410abf114be38505a"
// user_id: "614d1c5cb0fb2153367af21f"

// 全选
export const allSelect = (data) => request.post('cart/all_select',data)
    //demo.itlike.com/web/xlmc/api/cart/all_select     post
    // flag: false
    // user_id: "614d1c5cb0fb2153367af21f"


// 点击加
export const add = (data) => request.post('cart/num',{
  ...data,
  type: "add",
})
// 点击减
export const reduce = (data) => request.post('cart/num',{
  ...data,
  type: "reduce",
})
// goods_id: "5ceb7df410abf114be38505a"
// type: "reduce"
// user_id: "614d1c5cb0fb2153367af21f"

// 清空购物车
export const clear = (token) => request.get(`cart/clear/${token}`)
// http://demo.itlike.com/web/xlmc/api/cart/clear/614d1c5cb0fb2153367af21f?itlike=29947144318427595354    get
